// 引入vue
import Vue from 'vue'
// 引入路由组建
import Router from 'vue-router'
Vue.use(Router)

export default new Router({
  // Url中去掉#
  // mode: 'history',
  routes: [{
      path: '/',
      redirect: 'select'
    },
    // 资源管理路由
    {
      path: '/data',
      name: 'index',
      component: () => import("@/components/index"),
      children: [{
          path: 'notice',
          name: 'notice',
          component: () => import("@/components/dbs/notice"),
          meta: {
            title: '最新公告'
          }
        },
        // loading页面
        {
          path: 'loading',
          name: 'loading',
          component: () => import("@/components/loading")

        }, {
          path: 'search',
          name: 'search',
          component: () => import("@/components/dbs/search"),
          meta: {
            title: '搜索资源'
          }
        }, {
          path: 'state',
          name: 'state',
          component: () => import("@/components/dbs/state"),
          meta: {
            title: '资源状态'
          }
        }, {
          path: 'label',
          name: 'label',
          component: () => import("@/components/dbs/label"),
          meta: {
            title: '资源标记'
          }
        },
        {
          path: 'article/:id',
          name: 'article',
          component: () => import("@/components/dbs/article"),
          meta: {
            title: '最新公告'
          }
        },
        {
          path: 'create',
          name: 'create',
          component: () => import("@/components/dbs/create"),
          meta: {
            title: '新建资源'
          }
        },
        {
          path: 'sem',
          name: 'sem',
          component: () => import("@/components/dbs/sem"),
          meta: {
            title: '推广资源'
          }
        },
        {
          path: 'seo',
          name: 'seo',
          component: () => import("@/components/dbs/seo"),
          meta: {
            title: '免费资源'
          }
        },
        {
          path: 'getsick',
          name: 'getsick',
          component: () => import("@/components/dbs/getsick"),
          meta: {
            title: '住院患者'
          }
        },
        {
          path: 'socket',
          name: 'socket',
          component: () => import("@/components/socket"),
          meta: {
            title: '聊天页面'
          }
        },
        // 无权访问页面
        {
          path: 'role',
          name: 'role',
          component: () => import("@/components/role"),
          meta: {
            title: '没有权限访问'
          }
        },
      ]
    },
    // 员工管理路由
    {
      path: '/staff',
      name: 'staff',
      component: () => import("@/components/staff"),
      children: [{
        path: 'staffcreate',
        name: 'staffcreate',
        component: () => import("@/components/staff/create"),
        meta: {
          title: '新建员工'
        }
      }, {
        path: 'edit',
        name: 'edit',
        component: () => import("@/components/staff/edit"),
        meta: {
          title: '编辑页面'
        }

      }, {
        path: 'staffsearch',
        name: 'staffsearch',
        component: () => import("@/components/staff/search"),
        meta: {
          title: '搜索页面'
        }

      }, {
        path: 'status',
        name: 'status',
        component: () => import("@/components/staff/status"),
        meta: {
          title: '员工列表'
        }

      }, {
        path: 'news',
        name: 'news',
        component: () => import("@/components/staff/news"),
        meta: {
          title: '最新公告'
        }
      }, {
        path: 'statistics',
        name: 'statistics',
        component: () => import("@/components/staff/statistics"),
      }]
    },
    // 登陆路由
    {
      path: '/login',
      name: 'login',
      component: () => import("@/components/users/login"),
      meta: {
        title: '登录页面'
      }
    },
    // 注册路由
    {
      path: '/register',
      name: 'register',
      component: () => import("@/components/users/register"),
      meta: {
        title: '注册页面'
      }
    },
    // 手机注册
    {
      path: '/mobile',
      name: 'mobile',
      component: () => import("@/components/users/mobile"),
      meta: {
        title: '手机注册'
      }
    },
    // 邮箱注册路由
    {
      path: '/email',
      name: 'email',
      component: () => import("@/components/users/email"),
      meta: {
        title: '邮箱注册'
      }
    },
    // 登陆选择页面
    {
      path: '/select',
      name: 'select',
      component: () => import("@/components/select"),
      meta: {
        title: '选择系统'
      }

    },
    {
      path: '*',
      name: '/error',
      component: () => import("@/components/error"),
      meta: {
        title: '404页面'
      }
    },
  ]
})
